package com.lj.vod.controller;

import com.lj.vod.service.VodService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author luojing
 * @version 1.0
 * @date 2021/5/18 11:14
 */
@RestController
@RequestMapping("/vod")
@CrossOrigin
public class VodController{

    @Autowired
    private VodService vodService;

    @PostMapping("/upload")
    @ApiOperation("上传视频到阿里云")
    public Map<String,Object> upload(MultipartFile file){
        return vodService.uploadVideo(file);
    }

    @DeleteMapping("/delete/{id}")
    @ApiOperation("根据视频id删除阿里云的视频,支持删除多个id用逗号隔开")
    public Boolean delete(@PathVariable String id){
        return vodService.deleteById(id);
    }
}
